using Aurora.TaskScheduler.Abstractions;
using Aurora.TaskScheduler.Abstractions.BaseModel;
using Aurora.TaskScheduler.Abstractions.SchedulerAttributes;
using Quartz;

namespace TestScheduler.TaskScheduler;

[DisallowConcurrentExecution]
[Cron("0/10 * * * * ?", "每10秒执行一次", description: "TaskTestWeb,此方法用于测试使用")]
public class MyTestTask : ITaskJob<string>
{
    private readonly ILogger<MyTestTask> _logger;

    public MyTestTask(ILogger<MyTestTask> logger)
    {
        _logger = logger;
    }

    public async Task<JobResult> ExecuteAsync(string parameter)
    {
        _logger.LogWarning($"当前时间：{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},MyTestJob 执行了");
        return new JobResult()
        {
            Success = true,
            Message = "MyTestTask执行成功了"
        };
    }
}